import React from 'react';
import { FormTempMapping } from '../../Utils/FormTemp'

const SearchForm = ({ data, Off }) => {
    const { Event, fields, init } = data
    const formItem = fields.map(item => ({ span: 24, formType: item.type, name: item.key, label: item.label }))
    Event.useSubscription(val => {
        const { type, data } = val
        if (type === 'onClearBox') Off()
    })

    return (
        <div>
            <FormTempMapping formItem={formItem} FORMEVENT={Event} Initial={init} />
        </div>
    );
};

export default SearchForm;